package com.lin.videospringboot.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.lin.videospringboot.been.VideoComment;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

@Mapper
public interface VideoCommentMapper extends BaseMapper<VideoComment> {

    //    联表
    @Select("SELECT a.videoCommentId,a.content,a.likes,a.dislikes,a.time,b.userId,b.name,b.url FROM `videoComment` a , `user` b WHERE a.`userId` = b.`userId` AND a.videoId = videoId ORDER BY a.time DESC")
    List<Map<String,Object>> getVideoCommentWithUserInfo(int videoId);

}
